#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
	int all[8][9] = { {6,7,2,1,5,9,8,3,4},
					  {2,9,4,7,5,3,6,1,8},
					  {4,3,8,9,5,1,2,7,6},
					  {8,1,6,3,5,7,4,9,2},
					  {2,7,6,9,5,1,4,3,8},
					  {4,9,2,3,5,7,8,1,6},
					  {4,3,8,9,5,1,2,7,6},
					  {8,1,6,3,5,7,4,9,2} };
	int input[10];
	for (int i = 0; i < 9; i++)
	{ 
		scanf("%d", &input[i]);
	}
	
	int answer = 0;
	for (int i = 0; i < 8; i++)
	{
		int flag = 0;
		for (int j = 0; j < 9; j++)
		{
			if (input[j] == 0)
			{
				flag++;
			}
			if (input[j] == all[i][j])
			{
				flag++;
			}
		}
		if (flag == 9)
		{
			answer++;
			for (int k = 0; k < 9; k++)
			{
				input[k] = all[i][k];
				if (answer > 1)
				{
					break;
				}
			}
		}
	}
	

	if (answer > 1)
	{
		printf("Too Many");
	}
	else
	{
		for (int i = 0; i < 9; i++)
		{
			printf("%d ", input[i]);
			if (i % 3 == 2)
			{
				printf("\n");
			}
		}
	}
	return 0;
}